/**
 * 
 * @param {number} mean Mean value of the distribution
 * @param {number} stdd Standard error of the distribution
 * @returns A random number ~ normal distribution
 */
function generateNormalDistribution(mean, stdd) {
    let u1 = Math.random();
    let u2 = Math.random();
    let z0 = mean + stdd * (Math.sqrt(-2 * Math.log(u1)) * Math.cos(2 * Math.PI * u2));
    return Number(z0.toFixed(2));
}

/**
 * Get all months of the year
 * @param {number} year 
 * @returns month array
 */
function getAllMonth(year) {
    let monthArray = [];
    for (let i = 1; i < 13; i++) {
        monthArray.push(i < 10 ? `${year}` + '-0' + `${i}` : `${year}-` + `${i}`);
    }
    return monthArray;
}

/**
 * Get all date in month, date case would be like 2023-12-11
 * @param {number} year 
 * @param {number} month 
 * @returns date array
 */
function getAllDateInMonth(year, month) {
    var dateArray = [];
    var currentDate = new Date(year, month - 1, 1, 12);
    while (currentDate.getMonth() === month - 1) {
        dateArray.push(new Date(currentDate).toISOString().slice(0, 10));
        currentDate.setDate(currentDate.getDate() + 1);
    }
    return dateArray;
}